home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / FixMath.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  3.4 KB  |  142 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        FixMath.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT FixMath;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __FIXMATH__}
  27. {$SETC __FIXMATH__ := 1}
  28.  
  29. {$I+}
  30. {$SETC FixMathIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$PUSH}
  40. {$ALIGN MAC68K}
  41. {$LibExport+}
  42.  
  43. CONST
  44.     fixed1                        = $00010000;
  45.     fract1                        = $40000000;
  46.     positiveInfinity            = $7FFFFFFF;
  47.     negativeInfinity            = $80000000;
  48.  
  49.  
  50. FUNCTION Fix2Frac(x: Fixed): Fract;
  51.     {$IFC NOT GENERATINGCFM}
  52.     INLINE $A841;
  53.     {$ENDC}
  54. FUNCTION Fix2Long(x: Fixed): LONGINT;
  55.     {$IFC NOT GENERATINGCFM}
  56.     INLINE $A840;
  57.     {$ENDC}
  58. FUNCTION Long2Fix(x: LONGINT): Fixed;
  59.     {$IFC NOT GENERATINGCFM}
  60.     INLINE $A83F;
  61.     {$ENDC}
  62. FUNCTION Frac2Fix(x: Fract): Fixed;
  63.     {$IFC NOT GENERATINGCFM}
  64.     INLINE $A842;
  65.     {$ENDC}
  66. FUNCTION FracMul(x: Fract; y: Fract): Fract;
  67.     {$IFC NOT GENERATINGCFM}
  68.     INLINE $A84A;
  69.     {$ENDC}
  70. FUNCTION FixDiv(x: Fixed; y: Fixed): Fixed;
  71.     {$IFC NOT GENERATINGCFM}
  72.     INLINE $A84D;
  73.     {$ENDC}
  74. FUNCTION FracDiv(x: Fract; y: Fract): Fract;
  75.     {$IFC NOT GENERATINGCFM}
  76.     INLINE $A84B;
  77.     {$ENDC}
  78. FUNCTION FracSqrt(x: Fract): Fract;
  79.     {$IFC NOT GENERATINGCFM}
  80.     INLINE $A849;
  81.     {$ENDC}
  82. FUNCTION FracSin(x: Fixed): Fract;
  83.     {$IFC NOT GENERATINGCFM}
  84.     INLINE $A848;
  85.     {$ENDC}
  86. FUNCTION FracCos(x: Fixed): Fract;
  87.     {$IFC NOT GENERATINGCFM}
  88.     INLINE $A847;
  89.     {$ENDC}
  90. FUNCTION FixATan2(x: LONGINT; y: LONGINT): Fixed;
  91.     {$IFC NOT GENERATINGCFM}
  92.     INLINE $A818;
  93.     {$ENDC}
  94. {$IFC GENERATINGPOWERPC }
  95. FUNCTION WideAdd(VAR target: wide; {CONST}VAR source: wide): WidePtr; C;
  96. FUNCTION WideCompare({CONST}VAR target: wide; {CONST}VAR source: wide): INTEGER; C;
  97. FUNCTION WideNegate(VAR target: wide): WidePtr; C;
  98. FUNCTION WideShift(VAR target: wide; shift: LONGINT): WidePtr; C;
  99. FUNCTION WideSquareRoot({CONST}VAR source: wide): LONGINT; C;
  100. FUNCTION WideSubtract(VAR target: wide; {CONST}VAR source: wide): WidePtr; C;
  101. FUNCTION WideMultiply(multiplicand: LONGINT; multiplier: LONGINT; VAR target: wide): WidePtr; C;
  102. { returns the quotient }
  103. FUNCTION WideDivide({CONST}VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): LONGINT; C;
  104. { quotient replaces dividend }
  105. FUNCTION WideWideDivide(VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): WidePtr; C;
  106. FUNCTION WideBitShift(VAR src: wide; shift: LONGINT): WidePtr; C;
  107. {$ENDC}
  108. {$IFC GENERATING68K  & NOT GENERATING68881 }
  109. FUNCTION Frac2X(x: Fract): double_t;
  110.     {$IFC NOT GENERATINGCFM}
  111.     INLINE $A845;
  112.     {$ENDC}
  113. FUNCTION Fix2X(x: Fixed): double_t;
  114.     {$IFC NOT GENERATINGCFM}
  115.     INLINE $A843;
  116.     {$ENDC}
  117. FUNCTION X2Fix(x: double_t): Fixed;
  118.     {$IFC NOT GENERATINGCFM}
  119.     INLINE $A844;
  120.     {$ENDC}
  121. FUNCTION X2Frac(x: double_t): Fract;
  122.     {$IFC NOT GENERATINGCFM}
  123.     INLINE $A846;
  124.     {$ENDC}
  125. {$ELSEC}
  126. FUNCTION Frac2X(x: Fract): double_t;
  127. FUNCTION Fix2X(x: Fixed): double_t;
  128. FUNCTION X2Fix(x: double_t): Fixed;
  129. FUNCTION X2Frac(x: double_t): Fract;
  130. {$ENDC}
  131.  
  132. {$ALIGN RESET}
  133. {$POP}
  134.  
  135. {$SETC UsingIncludes := FixMathIncludes}
  136.  
  137. {$ENDC} {__FIXMATH__}
  138.  
  139. {$IFC NOT UsingIncludes}
  140.  END.
  141. {$ENDC}
  142.